package com.itheima.mapper;

import com.itheima.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserMapper {

    //分页查询
    @Select("select * from emp limit #{begin} , #{size}")
    List<User> selectByPage(int begin,int size);

    //查询总条数
    @Select("select count(*) from emp")
    int selectTotal();

    //新增数据
    @Insert(" insert into  emp values (#{username},#{email},#{age}) ")
    public int add(User user);

    //删除数据
    @Delete(" delete from emp where id= #{id} ")
    public int deleteById(Integer id);

    //更新数据
    @Update("update emp set username=#{username},email=#{email},age=#{age} where id=#{id} ")
    public int update(User user);
}
